<template>
	<view class="content">
		<view style="z-index: -2;">
			<image style="width: 100%;height:30%;position:fixed;top: 0;left: 0;" src="http://113.142.144.25:9301/statics/appimg/user_center_bg.png"></image>
		</view>
		<scroll-view class="scv">
			<view v-if="showNodata" style="height: 100vh; width:100vw;text-align: center;background-color: #fff;" @click="getUserDetail">
				<text style="text-align: center;line-height: 100vh;">{{noData}}</text>
			</view>
			<view class="head" >
				<view>
					<view class="top">
						<view class="center">
							<!-- <button type="warn" size="mini" style="float: right;margin-right: 25rpx;" @click="logOut">退出登录</button> -->
							<view class="center_top">
								<view class="center_img" @tap="gotoFeeds('/pages/my/set/set')">
									<!-- 这里可以放自己的静态头像 -->
							
									<image :src="userInfo.avatar ? userInfo.avatar : '../../static/images/myIcon.png'"></image>
							
									<!-- <open-data type="userAvatarUrl" class="user_head"></open-data> -->
								</view>
								<view class="center_info" @tap="gotoFeeds('/pages/my/set/set')">
									<view class="center_name">
										<view class="nickname">{{userInfo.realName}}</view>
									</view>
									<view class="center_vip">
										<image class="rank_icon" src="http://113.142.144.25:9301/statics/appimg/member_icon_new.png" />
										<view class="vip_text">
											<text>{{userType}}</text>
										</view>
									</view>
									
								</view>
							</view>
						</view>
					</view>
				 </view>
			</view>
			<view style="height: 50rpx;margin: 0 50rpx;background-color: #ffefd4;border-radius: 20rpx;"></view>
			<view class="menu_bar" >
				<view class="menu_list" v-for="(item, index) in menuList" :key="index" hover-stop-propagation="true"
						@click="index == 0 ? cuponList()
								:index == 1 ?askList()
								:index == 2 ?reportList()
								:index == 3 ?wantList()
								:''
							">
					<view hover-stop-propagation="true">
						<image class="menu_icon" :src= "item.icon"></image>
					</view>
					<view class="icon" hover-stop-propagation="true">
						<text>{{item.name}}</text>
					</view>
				</view>	
			</view>
			<view class="my_list">
				<!-- <view @click="cuponList()">
					<view class="form-left">我的创新券</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
				</view>
				<view class="devideline"></view>
				<view @click="askList()">
					<view class="form-left">我的咨询</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
				</view>
				<view class="devideline"></view> -->
				<!-- <view @click="zhiboList()">
					<image style="height: 35rpx;width: 35rpx;float: left;margin-top: 5rpx;"
					src="http://113.142.144.25:9301/statics/appimg/userCenter/icon_my_zhibo.png" mode=""></image>
					<view class="form-left">我的直播</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
					
				</view> -->
				<!-- <view class="devideline"></view> -->
				<!-- <view @click="serviceList()">
					<image style="height: 35rpx;width: 35rpx;float: left;margin-top: 5rpx;"
					src="http://113.142.144.25:9301/statics/appimg/userCenter/icon_my_service.png" mode=""></image>
					<view class="form-left">我的服务</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
					
				</view>
				<view class="devideline"></view> -->
				<!-- <view @click="wantList()">
					<view class="form-left">我的需求</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
					
				</view>
				<view class="devideline"></view> -->
				<!-- <view @click="orderList()">
					<image style="height: 35rpx;width: 35rpx;float: left;margin-top: 5rpx;"
					src="http://113.142.144.25:9301/statics/appimg/userCenter/icon_my_order.png" mode=""></image>
					<view class="form-left">我的订单</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
				</view> -->
			<!-- 	<view class="devideline"></view> -->
				<!-- <view @click="certificateInfo()">
					<image style="height: 35rpx;width: 35rpx;float: left;margin-top: 5rpx;" 
					src="http://113.142.144.25:9301/statics/appimg/userCenter/icon_my_certificate.png" mode=""></image>
					<view class="form-left">我的认定</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
				</view> -->
	<!-- 			<view class="devideline"></view> -->
				<!-- <view @click="helpCenter()">
					<image style="height: 35rpx;width: 35rpx;float: left;margin-top: 5rpx;" src="http://113.142.144.25:9301/statics/appimg/user_icon_set_new.png" mode=""></image>
					<view class="form-left">帮助中心</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
				</view> -->
				<view @click="searchCenter()">
					<image style="height: 35rpx;width: 35rpx;float: left;margin-top: 5rpx;" src="../../static/images/techSearch.png" mode=""></image>
					<view class="form-left">我的查新</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
				</view>
				<view class="devideline"></view> 
				<view @click="examCenter()">
					<image style="height: 35rpx;width: 35rpx;float: left;margin-top: 5rpx;" src="../../static/images/techSearch.png" mode=""></image>
					<view class="form-left">我的测评</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
				</view>
				<view class="devideline"></view> 
				<view @click="helpCenter()">
					<image style="height: 35rpx;width: 35rpx;float: left;margin-top: 5rpx;" src="../../static/images/techSearch.png" mode=""></image>
					<view class="form-left">常见问题</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
				</view>
				<view class="devideline"></view> 
				<view @click="logOut()">
					<image style="height: 35rpx;width: 35rpx;float: left;margin-top: 5rpx;" src="http://113.142.144.25:9301/statics/appimg/user_icon_set_new.png" mode=""></image>
					<view class="form-left">退出登录</view>
					<image style="height: 35rpx;width: 35rpx;float: right;" src="http://113.142.144.25:9301/statics/appimg/arrow1_new.png" mode=""></image>
				</view>
				<view class="devideline"></view> 
			</view>
		</scroll-view>
	</view>
</template>

<script>
	// 引入vuex
		import {
			mapState,
			mapMutations,
			mapGetters
		} from 'vuex';
		
		import * as user from '../../api/login.js'
		
		export default {
			data() {
				return {
					id:'',
					image:'',
					userInfo:'',
					nickName:'',
					wx_userInfo:{},
					userDetail:{},
					noData:'加载中。。。',
					showNodata:true,
					isBack:false,
					total:0,
					menuList:[
						{name:'可转化成果',icon:'http://113.142.144.25:9301/statics/appimg/userCenter/icon_my_cupon.png'},
						{name:'我的预约',icon:'http://113.142.144.25:9301/statics/appimg/userCenter/icon_my_ask.png'},
						{name:'我的申报',icon:'http://113.142.144.25:9301/statics/appimg/userCenter/icon_my_report.png'},
						{name:'我的需求',icon:'http://113.142.144.25:9301/statics/appimg/userCenter/icon_my_wants.png'},
					],
					userType:'个人用户'
				}
			},
			onLoad(option) {
				uni.showLoading({})
				this.getUserDetail()
			},
			onShow(){
				uni.showLoading({})
				this.getUserDetail()
			},
			methods: {
				getUserDetail(){
					var mystorage = uni.getStorageSync("userInfo") || []
					if(mystorage.login_user == null){
						uni.navigateTo({
							url:'/subpages/pages/register/login_province'
						})
						uni.hideLoading()
						this.noData = '请先点击此处登录'
					}else{
						console.log(mystorage);
						if(mystorage.login_user.member.userType==='1'){
							this.userType = '个人用户'
						}else{
							this.userType = '企业用户'
						}
						this.userInfo = mystorage.login_user.member
						console.log(this.userInfo);
						this.id = this.userInfo.id
						this.nickName = this.userInfo.realName
						uni.hideLoading()
						this.showNodata = false
					}
				},
				gotoFeeds(url) {
					// // 可以跳多级目录
					// uni.navigateTo({
					// 	url
					// })
				},
				logOut(){
					// user.logout();
					uni.showModal({
						title:'提示',
						content:'您确定要退出账号吗？',
						success(res) {
							if(res.confirm){
								uni.removeStorage({
									key:'userInfo'
								})
								uni.navigateTo({
									url:'/subpages/pages/register/login_province'
								})
							}else{
								console.log('取消退出');
							}
						}
					})
				},
				cuponList(id){
					uni.navigateTo({
						url:'/subpages/pages/my/transferableResult/transferableResult'
					})
				},
				certificateInfo(){
					uni.navigateTo({
						url:'/subpages/pages/companyCertificate/company_certificate'
					})
				},
				orderList(){
					uni.navigateTo({
						url:'/subpages/pages/my/orderList/order_list'
					})
				},
				zhiboList(){
					uni.showToast({
						icon:'none',
						title:'全力开发中，敬请期待！'
					})
				},
				wantList(){
					uni.navigateTo({
						url:'/subpages/pages/my/wantList/want_list'
					})
				},
				serviceList(){
					uni.navigateTo({
						url:'/subpages/pages/my/serviceList/service_list'
					})
				},
				gotoSet(){
					uni.navigateTo({
						url:'/subpages/pages/set/set?id='+this.id
					})
				},
				reportList(){
					uni.navigateTo({
						url:'/subpages/pages/report/report_index'
					})
				},
				askList(){
					uni.navigateTo({
						url:'/subpages/pages/my/ask/ask_list'
					})
				},
				helpCenter(){
					uni.navigateTo({
						url:'/subpages/pages/commonQuestion/question_list'
					})
				},
				searchCenter(){
					uni.navigateTo({
						url:'/subpages/pages/projectSearch/list'
					})
				},
				examCenter(){
					uni.navigateTo({
						url:'/subpages/pages/companyCertificate/list'
					})
				}
			}
		};
</script>

<style>
	.scv {
		width: 100%;
		height: 100vh;
		margin: 0 auto;
		background: #e6e6e6;
	}
	
	/* .head {
		width: 100%;
		height: 400rpx;
		background-color: #016fb8;
	} */
	
	.my_list {
		margin: 20rpx 35rpx;
		background-color: #fff;
		border-radius: 15rpx;
		padding: 30rpx;
	}
	
	.form-left{
		display: inline;
		margin-left: 16px;
		padding:18px 0;
		margin: 20rpx 16rpx;
	}
	
	
	.devideline {
		float: left; 
		height: 0.3rpx;
		width:100%;
		background-color: #eeeeee;
		margin-top: 30rpx;
		margin-bottom: 30rpx;
	}
	
	Page {
			font-size: 14px;
		}
	
	.top {
		width: 100%;
		height: 120px;
		padding-top: 45px;
		position: relative;
		border-radius: 40%;
/* 		background: url('') */
	}
	
/* 	.center {
		width: 95%;
		height: 150px;
		background: white;
		display: flex;
		flex-direction: column;
		margin: 0 auto;
		border-radius: 5px;
	} */
	
	.center_top {
		display: flex;
		flex-direction: row;
		width: 80%;
		height: 80px;
		margin: 0 auto;
		margin-top: 30rpx;
		/* border-bottom: 1px solid #EEEEEE; */
	}
	
	.center_img {
		width: 66px;
		height: 66px;
		border-radius: 50%;
		overflow: hidden;
	}
	
	.center_img image {
		width: 100%;
		height: 100%;
		border-radius: 50%;
	}
	
	.center_img .user_head {
		width: 100%;
		height: 100%;
	}
	
	.center_info {
		display: flex;
		flex-direction: column;
/* 		margin-top: 5rpx; */
		margin-left: 30px;
	}
	
	.center_name {
		font-size: 20px;
		float: left;
	}
	
	.center_phone {
		color: #BEBEBE;
	}
	
	.center_rank {
		width: 50%;
		height: 35px;
		display: flex;
		flex-direction: row;
	}
	
	.rank_text {
		height: 35px;
		line-height: 35px;
		margin-left: 10rpx;
		color: #AAAAAA;
	}
	
	.center_vip image {
		width: 25px;
		height: 25px;
		margin-top: 15rpx;
	}
	
	.vip_icon {
		width: 25px;
		height: 25px;
		margin-top: -10rpx;
	}
	
	.vip_text {
		margin-top: -55rpx;
		margin-left: 65rpx;
		color: #fff;
	}
	
	.center_rank image {
		width: 35px;
		height: 35px;
	}
	
	.center_score {
		width: 50%;
		height: 35px;
		display: flex;
		flex-direction: row;
	}
	
	.center_score image {
		width: 35px;
		height: 35px;
	}
	
	.gif-wave {
		position: absolute;
		width: 100%;
		bottom: 0;
		left: 0;
		z-index: 99;
		mix-blend-mode: screen;
		height: 100rpx;
	}
	
	.wrapper {
		position: absolute;
		top: 0;
		bottom: 0;
		width: 100%;
		background-color: #F4F4F4;
	}
	
	.profile {
		height: 375rpx;
		background-color: #ea4451;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	
	.avatar {
		display: block;
		width: 170rpx;
		height: 170rpx;
		border-radius: 50%;
		border: 2rpx solid #fff;
		overflow: hidden;
	}
	
	.nickname {
		display: block;
		text-align: center;
		margin-top: 20rpx;
		font-size: 30rpx;
		color: #fff;
	}
	
	.menu_bar {
		height: 200rpx;
		background-color: #fff;
		margin: -10rpx 30rpx 15rpx 30rpx;
		border-radius: 15rpx;
		display: flex;
		justify-content: space-around;
	}
	
	.icon {
		margin: 0 auto;
		text-align: center;
	}
	
	.menu_icon {
		width: 60rpx;
		height: 70rpx;
		padding: 15rpx;
		margin-top: 10rpx;
	}
	
	.menu_list {
		font-size: 25rpx;
		margin-top: 10rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
</style>